from bopress.hook import add_static_path, add_menu_page, add_action

plugin_name = "Static File Demo"
version = "1.0"

# {{plugin_static_url("staticfiledemo/static/abc.txt", "1.0")}}
add_static_path("staticfiledemo/static")
add_menu_page("Plugin Static File Demo", "Plugin Static File Demo", "plugin-static-file-demo", ["read"],
              "staticfiledemo/tpl/ztree.html")


def scripts(res, current_screen):
    if current_screen.id == "plugin-static-file-demo":
        res.enqueue_plugin_script(src="staticfiledemo/static/js/jquery.ztree.core.js", ver="3.5.28")


def styles(res, current_screen):
    if current_screen.id == "plugin-static-file-demo":
        res.enqueue_plugin_style(src="staticfiledemo/static/css/zTreeStyle/zTreeStyle.css", ver="3.5.28")


add_action("bo_enqueue_styles", styles)
add_action("bo_enqueue_scripts", scripts)
